<template>
	<view>
		<view style="height: 140rpx;background-color: #F1F1F1;text-align: center;line-height: 140rpx;">由于我是自定义导航栏，所以开屏页重定向到这里，没有返回按钮</view>
		我是首页
		<button @click="go1">跳转到index1页面</button>
		<button @click="go2">跳转到index2页面</button>
		title的值为:{{title}}
		article的值为:{{article}}
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 0,
				article: ''
			}
		},
		components: {
		
		},
		onLoad() {
			uni.$on('watchIndex1', (data) => {
				console.log(data);
				this.getData(data);
			})
		},
		methods: {
			go1(){
				uni.navigateTo({
					url: '../index1/index1'
				})
			},
			go2(){
				uni.navigateTo({
					url: '../index2/index2'
				})
			},
			getData(v){
				// 模拟请求
				// setTimeout(()=>{
				// 	let a = Math.random();
				// 	this.article = `芜湖，我是title${a}的标题`
				// },1000)
				if(v == 1){
					setTimeout(()=>{
						this.title = 1
						this.article = '芜湖，我是title1的标题'
					},1000)
				}
				if(v == 2){
					setTimeout(()=>{
						this.title = 2
						this.article = '芜湖，我是title2的标题'
					},1000)
				}
			}
		}
	}
</script>

<style>

</style>
